package com.tianzeculture.stagebao.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.Window;
import android.view.WindowManager;

import com.tianzeculture.stagebao.R;
import com.tianzeculture.stagebao.network.util.DensityUtil;

/**
 * Created by Administrator on 2018/5/25 0025.
 */

public class ErrorDialog {
    private Dialog dialog;

    public ErrorDialog(Context context) {
        init(context);
    }

    private void init(final Context context) {
        dialog = new Dialog(context, R.style.DialogPushUpInAnimStyle);
        dialog.setContentView(R.layout.dialog_photo);
        dialog.setCanceledOnTouchOutside(true);
        dialog.setCancelable(true);

        Window window = dialog.getWindow();
        WindowManager.LayoutParams layoutParams = window.getAttributes();

        layoutParams.width = DensityUtil.getScreenWidth(context) * 7 / 10;
        window.setAttributes(layoutParams);
    }

    /**
     *
     */
    public void show() {
        dialog.show();
    }

    /**
     *
     */
    public void dismiss() {
        dialog.dismiss();

    }
}
